package com.fxp.project.jiuselu.web.models.goods.service.impl;

import com.fxp.project.jiuselu.web.models.goods.entity.JslActivity;
import com.fxp.project.jiuselu.web.models.goods.entity.JslGoodsAttr;
import com.fxp.project.jiuselu.web.models.goods.mapper.JslGoodsAttrMapper;
import com.fxp.project.jiuselu.web.models.goods.service.IJslGoodsAttrService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fxp.project.jiuselu.web.models.goods.vo.GoodsAttrVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品规格表 服务实现类
 * </p>
 *
 * @author Jason.Wang
 * @since 2021-11-01
 */
@Service
public class JslGoodsAttrServiceImpl extends ServiceImpl<JslGoodsAttrMapper, JslGoodsAttr> implements IJslGoodsAttrService {

    JslGoodsAttrMapper jslGoodsAttrMapper;

    @Autowired
    public void setJslGoodsAttrMapper(JslGoodsAttrMapper jslGoodsAttrMapper) {
        this.jslGoodsAttrMapper = jslGoodsAttrMapper;
    }

    /**
     * selectGoodsAttrVoListByGoodsId: 获取商品的规矩列表信息<br/>
     *
     * @param goodsId
     * @return
     * @author Jason.Wang
     * @date 2021/11/7 10:17 上午
     */
    @Override
    public List<GoodsAttrVo> selectGoodsAttrVoListByGoodsId(Long goodsId) {
        return jslGoodsAttrMapper.selectGoodsAttrVoListByGoodsId(goodsId);
    }

    @Override
    public List<JslActivity> selectGoodsActivityByGoodsId(Long goodsId) {
        return jslGoodsAttrMapper.selectGoodsActivityByGoodsIdAndAttrId(goodsId);
    }

    @Override
    public int updateStoreCountByGoodsIdAndAttrId(Integer stock, Long goodsId, Long attrId) {
        return jslGoodsAttrMapper.updateStoreCountByGoodsIdAndAttrId(stock, goodsId, attrId);
    }

    @Override
    public GoodsAttrVo selectGodosAttrVoListBtAttrId(Long attrId) {
        return jslGoodsAttrMapper.selectGoodsAttrVoByGoodsAttrId(attrId);
    }
}
